package schemas

import (
	"time"

	"github.com/gin-gonic/gin"
)

type CreateTask struct {
	ID         uint      `json:"id" default:"0"`
	Name       string    `json:"name" validate:"required"`
	ParentID   uint      `json:"parent_id"`
	Describe   string    `json:"describe"`
	ProjectID  uint      `json:"project_id" validate:"required"`
	Type       uint8     `json:"type" validate:"required"`
	KeyWords   string    `json:"key_words"`
	Handlers   []uint    `json:"handlers"`
	AnnexUrls  []string  `json:"annex_urls"`
	State      uint8     `json:"state" validate:"required"`
	ExpectedAt time.Time `json:"expected_at"`
}

func (s *CreateTask) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}

type QueryTask struct {
	Name      string `json:"name"`
	ParentID  uint   `json:"parent_id"`
	CreateBy  string `json:"create_by"`
	Handlers  []uint `json:"handlers"`
	ProjectID uint   `json:"project_id"`
	State     uint8  `json:"state"`
	Type      uint8  `json:"type"`
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
	Page      int    `json:"page" default:"1"`
	PageSize  int    `json:"pageSize" default:"10"`
}

func (s *QueryTask) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}
